<script setup>
import {
  VideoCameraFilled,
  Document,
  FolderOpened,
  User
} from '@element-plus/icons-vue'
import { useRouter } from 'vue-router';
import { onMounted, onUnmounted } from 'vue'

onMounted(() => {
  document.documentElement.classList.remove('dark');
})
onUnmounted(() => {
  document.documentElement.classList.add('dark');
})

const router = useRouter();

</script>

<template>
  <el-container class="container">
    <el-aside class="container-left-aside">
      <div class="logo-container">
        <span class="logo">YH Creator</span>
      </div>
      <el-menu
        router
        :default-active="$route.path"
        background-color="#f9fafb"
        text-color="#34495e"
        active-text-color="#409EFF"
      >
        <el-menu-item index="/creator" :route="{ path: '/creator' }">
          <el-icon><VideoCameraFilled /></el-icon>
          <span>首页</span>
        </el-menu-item>
        <el-menu-item index="/content" :route="{ path: '/content' }">
          <el-icon><Document /></el-icon>
          <span>内容管理</span>
        </el-menu-item>
        <el-menu-item index="/library" :route="{ path: '/library' }">
          <el-icon><FolderOpened /></el-icon>
          <span>素材库</span>
        </el-menu-item>
        <el-menu-item index="/profile" :route="{ path: '/profile' }">
          <el-icon><User /></el-icon>
          <span>个人中心</span>
        </el-menu-item>
      </el-menu>
      <div class="footer" @click="router.push('/')">
        YH
      </div>
    </el-aside>
    <el-main>
      <router-view></router-view>
    </el-main>
  </el-container>
</template>

<style lang="scss" scoped>
.container {
  width: 100vw;
  height: 100vh;
  color: black !important;

  
  .container-left-aside {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 18%;
    background-color: #f9fafb;
    border-right: 1px solid #e6e6e6;
    
    .logo-container {
      padding: 24px 0;
      text-align: center;
      
      .logo {
        font-size: 22px;
        font-weight: 700;
        color: #409EFF;
        letter-spacing: 1px;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      }
    }
    
    .el-menu {
      flex: 1;
      border-right: none;
      
      .el-menu-item {
        height: 60px;
        line-height: 60px;
        margin: 6px 12px;
        border-radius: 6px;
        transition: all 0.3s;
        
        &:hover {
          background-color: rgba(64, 158, 255, 0.1) !important;
        }
        
        &.is-active {
          background-color: rgba(64, 158, 255, 0.15) !important;
          border-left: 3px solid #409EFF;
        }
        
        .el-icon {
          font-size: 20px;
          margin-right: 10px;
        }
        
        span {
          font-size: 15px;
          font-weight: 500;
        }
      }
    }

    .footer {
      padding: 8px;
      border-top: 1px solid #dbdee1;
      text-align: center;
      font-weight: bold;
      color: #409EFF;
      cursor: pointer;
    }
  }
}

</style>